package com.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * RefreshScope 动态刷新
 * 动态刷新地址  configserver post请求  localhost:60002/actuator/bus-refresh
 *                          或
 *             configclient post请求  localhost:61001/actuator/bus-refresh
 * 无论刷新地址在server端或者client端 都可以刷新配置
 * @author: 顾志杰
 */
@RestController
@RequestMapping("refresh")
@RefreshScope
public class RefreshController {

    @Value("${words}")
    private String words;

    @Value("${food}")
    private String food;

    @GetMapping("words")
    public String getWords(){
        return words;
    }

    @GetMapping("dinner")
    public String dinner(){
        return food;
    }
}
